<template>
  <el-dropdown @command="changLanguage">
    <span class="el-dropdown-link">
      <svg-icon style="color:#fff;font-size:20px" icon-class="language" />
    </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="zh" :disabled="$i18n.locale === 'zh'">中文</el-dropdown-item>
      <el-dropdown-item command="en" :disabled="$i18n.locale === 'en'">English</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>

export default {
  name: 'Lang',
  methods: {
    changLanguage(command) {
      // 将获取到的 en 和 zh 赋值给 locale
      this.$i18n.locale = command

      this.$message.success('语言切换成功')
    }
  }

}
</script>

<style lang="sss" scoped>

</style>>

